'use strict';

/**
 * role model
 */
module.exports = app => {
  const { STRING, INTEGER, TINYINT } = app.Sequelize;
  const Role = app.model.define('role', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    name: STRING,
    status: TINYINT,
    created_person: STRING,
    updated_person: STRING
  }, {
      freezeTableName: true,
      tableName: 'role'
    });

  Role.associate = function () {
    app.model.Role.hasOne(app.model.Admin, { foreignKey: 'role_id' })
    
  }
  return Role;
}
